package com.taikang.hmp.hbusiness.diabetes.measure.pressure.action.view;

import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.taikang.hmp.frame.common.TKException;
import com.taikang.hmp.frame.common.datastructre.Dto;
import com.taikang.hmp.frame.common.datastructre.support.BaseDto;
import com.taikang.hmp.frame.common.datastructre.support.ResponseDto;
import com.taikang.hmp.frame.common.web.action.BaseAction;
import com.taikang.hmp.hbusiness.diabetes.measure.pressure.bean.Pressure;
import com.taikang.hmp.hbusiness.diabetes.measure.pressure.service.IPressureService;

/** 
 * 血压
 * author:wyf
 * time:2015年8月5日 上午11:02:42
 */
public class PressureViewAction extends BaseAction{
	private static Logger logger = LoggerFactory.getLogger(PressureViewAction.class);

	private IPressureService pressureService;

	public IPressureService getPressureService() {
		return pressureService;
	}

	public void setPressureService(IPressureService pressureService) {
		this.pressureService = pressureService;
	}

	public String executeAction()  {
		// 显示血压折线图
		if ("showPressureChart".equals(requestDto.getMethod())) {
			return showPressureChart();
			// 显示血压表
		}  else {
			throw new TKException("no support method:"+requestDto.getMethod());
		}
	}

	/**
	 * 显示血压折线图
	 * 
	 * @return
	 */
	public String showPressureChart()  {
		logger.info("进入showPressureChart方法体:"+requestDto.toString());
		//通用校验
		ResponseDto responseDto = new ResponseDto();			
		//获取参数
		Dto paramDto = requestDto.getRequestlist().get(0);
		paramDto = super.appendRequestBase(paramDto, requestDto);
		List<Pressure> records = pressureService.getPressureChartList(paramDto);
		
		Dto dto = new BaseDto();
		dto.put("records", records);
		responseDto.pushResultDto(dto);
		super.setDataMap(responseDto);
		return SUCCESS;
	}

}
